import Immutable from "immutable";

import {
	TESTCAR_DATA,
	TESTCAR_PAGING,
} from '../../action/testcar'

const initialState = Immutable.fromJS({
	testcar_data: '',
	testcar_paging: '',
	testcar_data_length:''
});

export default function testcar(state = initialState, action = {}) {
	switch (action.type) {
		case TESTCAR_DATA: {
			state = state.set('testcar_data', action.payload);
			state = state.set('testcar_data_length', action.payload.length);
			break;
		}
		case TESTCAR_PAGING: {
			state = state.set('testcar_paging', action.payload);
			break;
		}
		default: {
			return state
		}
	}

	return state;
}